<?php

class Application_Form_GestionGroupe_SuppressionMembreForm extends Zend_Form {
	
	public function init() {
		$session = new Zend_Session_Namespace("codebar");
		$this->setName('suppressionmembre');
		$this->clearDecorators();
		$this->setDecorators(array(
			'FormElements',
			'Form'
			));

			$r = new Application_Model_RolesUsers();
			$vendeurs = $r->getVendeurs($session->user->getGroupeActif()->getID());

			$formname = new Zend_Form_Element_Hidden('formname');
			$formname->setValue('suppression');
			$this->addElement($formname);

			foreach($vendeurs as $m)
			{
				$vendeur = new Zend_Form_Element_Checkbox($m);
				$vendeur->setLabel($m)
				->setValue(0)
				->setDecorators(array('ViewHelper',
				'FormErrors',
				array(array('data'.$m => 'HtmlTag'), array('tag' => 'td')),
				array('Label', array('tag' => 'td')),
				array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
				'Errors'));
				$this->addElement($vendeur);
			}

			$send = new Zend_Form_Element_Submit('send');
			$send->setLabel('Suppression')
			->setDecorators(array('ViewHelper',
				'FormErrors',
				'Errors'))
			->setAttrib('class','button');
			if(count($vendeurs) == 0)
			{
				echo "<script language=\"javascript\">Disabled('send');</script>";
			}
			$this->addElement($send);
	}
}